#!/sbin/openrc-run

name="MiniDLNA"
configfile="${CONFIG:-/etc/minidlna.conf}"
start_stop_daemon_args="--user ${M_USER:-minidlna} --group ${M_GROUP:-minidlna}"
pidfile="/run/minidlna/minidlna.pid"
command=/usr/sbin/minidlnad
command_args="-f ${configfile} -P $pidfile"

depend() {
	need net
}

start_pre() {
	if ! [ -f "${configfile}" ]; then
		eerror "${configfile} is missing"
		return 1
	fi
	if yesno "${RESCAN}"; then
		command_args="$command_args -R"
	fi
	
	checkpath --owner  ${M_USER:-minidlna}:${M_GROUP:-minidlna} \
		--directory ${pidfile%/*}
}

